<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        //1.Number.EPSILON 计算js表示最小精度
        function equal(a, b) {
            if(Math.abs(a - b) < Number.EPSILON) {
                return true;
            }else{
                return false;
            }
        }
        console.log(0.1 + 0.2 === 0.3);
        console.log(equal(0.1 + 0.2, 0.3));

        //2.进制
        let b = 0b1010;
        let o = 0o72;
        let d = 100;
        let x = 0xff;
        console.log('二进制:', b);
        console.log('八进制:', o);
        console.log('十进制:', d);
        console.log('十六进制:', x);

        //3.Number.isFinite 检测一个数值是否是有限数
        console.log(Number.isFinite(100));
        console.log(Number.isFinite(100/0));
        console.log(Number.isFinite(Infinity));

        //4.Number.isNaN 检测一个数是否为NaN
        console.log('4:', Number.isNaN(123));

        //5.Number.parseInt, Number.parseFloat字符串转整数
        console.log('5.转整数:', Number.parseInt('5210314我爱你'));
        console.log('5.转小数:', Number.parseFloat('3.1415926我爱你'));

        //6.Number.isInteger 判断一个数是否为整数
        console.log('6.判断是否整数:', Number.isInteger(3));
        console.log('6.判断是否整数:', Number.isInteger(3.14));

        //7.Math.trunc 将整数的小数抹掉
        console.log('7:', Math.trunc(3.5));

        //8.Math.sign 判断一个数到底是正数、负数还是零
        console.log('正数返回1:', Math.sign(200));
        console.log("0返回0:", Math.sign(0));
        console.log('负数返回-1:', Math.sign(-200));

    </script>
</body>
</html>